//
//  FunctionMacro.h
//  QuickAskCommunity
//
//  Created by yuemei on 2017/10/31.
//  Copyright © 2017年 ym. All rights reserved.
//

#define OBJC_STRINGIFY(x) @#x
#define STRINGIFY(x) #x

#define CLUE            @"1090"

#define PATH            NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES)[0]



#define DATA(X)                             [X dataUsingEncoding:NSUTF8StringEncoding]

//#define IMAGE(X)        [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:X ofType:@"png"]]
#define IMAGEFORIMAGES(X)   [UIImage imageNamed:(X)]
#define IMAGE(X)            IMAGEFORIMAGES(X)

//#define SFONT(X)         [UIFont fontWithName:@"SourceHanSansCN-Light" size:X]
//#define BFONT(X)         [UIFont fontWithName:@"SourceHanSansCN-Regular" size:X]

#define SFONT(X)            [[NSUserDefaults standardUserDefaults] objectForKey:@"YM_APPLY_FONTNAME"] == nil ? [UIFont systemFontOfSize:(X)] : [UIFont fontWithName:[[NSUserDefaults standardUserDefaults] objectForKey:@"YM_APPLY_FONTNAME"] size:(X)]
#define BFONT(X)            [UIFont systemFontOfSize:(X)]
#define IFONT(X)            [UIFont italicSystemFontOfSize:(X)]
#define NFONT(X)         [UIFont fontWithName:@"ArialMT" size:X]

#define YMQHFONT(X)         [UIFont ym_qhFontWithSize: (X)]

#define CCOLOR(X)        [UIColor createWithColorType:(X)]
#define CCOLORA(X,A)     [UIColor createWithColorType:(X) alpha:(A)]

#define PROJECT         [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleExecutableKey]

#define WINDOW          ((YMAppDelegate *)([UIApplication sharedApplication].delegate)).window

//scrollView调整
#define SCROLLVIEW_ADJUS(Controller,View) if (@available(iOS 11.0, *)) {View.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;} else {Controller.automaticallyAdjustsScrollViewInsets = NO;}
//视图拉伸修改
#define EXTENDED_LAYOUT_NONE self.edgesForExtendedLayout = UIRectEdgeNone;

//debugLog
#ifdef DEBUG //处于开发阶段
#define MLog(fmt, ...) printf("%s [Line %d]\n %s\n", __PRETTY_FUNCTION__, __LINE__,  [[NSString stringWithFormat:fmt, ##__VA_ARGS__] UTF8String]);
#else //处于发布阶段
#define MLog(...)
#endif

//方法执行时间
#define METHOD_TIME_TICK   NSDate *startTime = [NSDate date];
#define METHOD_TIME_TOCK   NSLog(@"CodeRunTime: %f", -[startTime timeIntervalSinceNow]);

#define IPHONE_7_0_AFTER_VERSION __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_7_0
